﻿//********************************************************************************//
//创建日期：<创建日期，2017-9-26>
//页面创建：<孙雪婷，sunxueting@shanghai3h.com>
//功能说明：生成旧欠托收
//********************************************************************************//
using BLL;
using BLL.Access;
using DevExpress.Web;
using Entity;
using System;
using System.Data;
using System.Web;
using Web.Class;

namespace Web.Pages.QuShui.DiXiaS.ShouFeiGL
{
    public partial class JiuQianTS : BasePage
    {
        #region 属性
        /// <summary>
        /// 保存结果集1
        /// </summary>
        private DataTable dtGridTab1
        {
            get
            {
                return ViewState["dtGridTab1"] as DataTable;
            }
            set
            {
                ViewState["dtGridTab1"] = value;
            }
        }

        /// <summary>
        /// 保存结果集
        /// </summary>
        private DataTable dtSource2
        {
            get
            {
                return ViewState["dtSource2"] as DataTable;
            }
            set
            {
                ViewState["dtSource2"] = value;
            }
        }

        #endregion

        #region 变量
        SpHelper _SpHelper = new SpHelper();
        #endregion

        #region 事件
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadGridData();
        }

       
       
      
        #endregion

        #region 方法

        private void LoadGridData()
        {
            int type = 2;//旧欠托收
            this.dtGridTab1 = _SpHelper.P_QSCX_TUOSHOUXXCX(2, 1, type, 0).Tables[0];
            gvGridTab1.DataSource = this.dtGridTab1;
            gvGridTab1.DataBind();
            if (this.dtGridTab1 != null && this.dtGridTab1.Rows.Count > 0)
            {
                //zjl.Text = "共" + this.dtGridTab1.Rows.Count.ToString() + "条";
                gvGridTab1.FocusedRowIndex = 0;
                //加载详细信息
                int bianhao = Convert.ToInt32(this.gvGridTab1.GetRowValues(this.gvGridTab1.FocusedRowIndex, "I_BIANHAO"));
                DataTable dt = _SpHelper.P_QSCX_TUOSHOUXXCX(2, 2, type, bianhao).Tables[0];
                gvGridTab2.DataSource = dt;
                gvGridTab2.DataBind();
            }
        }


        /// <summary>
        /// grid2刷新
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvGridTab2_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            int type = 2;//旧欠托收
            int bianhao = Convert.ToInt32(this.hdCollection.Get("S_BIANHAO"));
            DataTable dt = _SpHelper.P_QSCX_TUOSHOUXXCX(2, 2, type, bianhao).Tables[0];
            gvGridTab2.DataSource = dt;
            gvGridTab2.DataBind();
        }
        #endregion

        protected void gvGridTab1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            LoadGridData();
        }
    }
}